<!doctype html>
<html lang="zh" class="no-js">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="stylesheet" href="/login/css/reset.css"> <!-- CSS reset -->
	<link rel="stylesheet" href="/login/css/style.css"> <!-- Gem style -->
	<script src="/login/js/modernizr.js"></script> <!-- Modernizr -->
	<script src="/layui/layui.js" charset="utf-8"></script>
	<link rel="stylesheet" href="/layui/css/layui.css">
<!--	<script src="https://cdn.bootcdn.net/ajax/libs/limonte-sweetalert2/11.1.0/sweetalert2.all.js"></script>-->
<!--	<link href="https://cdn.bootcdn.net/ajax/libs/limonte-sweetalert2/11.1.0/sweetalert2.css" rel="stylesheet">-->
</head>
<body>
<div class="bg-back">
<ul class="shadows">
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
</ul>
<ul class="drive">
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
</ul>	
</div>
	<div style="z-index: 10000;
    position: absolute;
    top: 0;
    left:calc(50% - 244px);
		"  class="cd-user-modal is-visible">
		<div class="cd-user-modal-container"> 
			<ul class="cd-switcher">
				<li><a href="" class="selected">账号密码登录</a></li>
			</ul>
			<div id="cd-login" class="is-visible is-selected"> <!-- log in form -->
				<form class="cd-form" action="/user/check/login" method="post">
					<p class="fieldset">
						<label class="image-replace cd-username" for="signup-username">账户名</label>
						<input class="full-width has-padding has-border username" id="signin-email" type="phone" placeholder="请输入账户名">
						<span class="cd-error-message">账户名错误</span>
					</p>
					<p class="fieldset">
						<label class="image-replace cd-password" for="signup-password">密码</label>
						<input class="full-width has-padding has-border password" id="signup-password"  type="password"  placeholder="请输入密码">
						<span class="cd-error-message">格式错误!</span>
							<a style="
							display: inline-block;
							position: absolute;
							right: 0px;
							cursor:pointer;
							bottom: -22px;
							font-size: 14px;
							color: #3277fc;" id="forget">忘记密码?</a>
					</p>
					<p class="fieldset">
						<input type="checkbox" id="remember-me" checked>
						<label for="remember-me">记住密码</label>
					</p>
					<p class="fieldset">
						<input class="full-width" type="submit" value="登录" id="submit">
					</p>
				</form>
			</div>
		</div>
<!--		<p style="-->
<!--		position: absolute;-->
<!--    bottom: 6em;-->
<!--    text-align: center;-->
<!--    width: 100%;"> -研发二部需求管理- </p>-->
	</div> <!-- cd-user-modal -->
<script src="/login/js/jquery.min.js"></script>
<script src="/login/js/main.js"></script> <!-- Gem jQuery -->
<script src="/js/jquery-3.5.1.js"></script>

<script>
	$("#forget").click(function () {
		layer.msg("请联系管理员")
	})



	$("#submit").click(function (){
		let username = $(".username").val();
		let password = $(".password").val();
		if (username != '' && password != ''){
			$.ajax({
				type:"POST",
				url:"/user/login",
				contentType:"application/json;charset=utf-8",
				data:JSON.stringify({"username":username,"password":password}),
				dataType:"json",
				success:function(data){
					console.log(data)
					if (data.code == 200){
						window.location.href='/';
					}else{
						layer.msg(data.message)
					}

				},
				error:function(jqXHR){
					alert("发送请求失败")
				}
			});
		}else{
			if (username == ''){
				alert("用户名为空。请填写用户名")
			}else{
				alert("pwd为空")
			}
		}
	})
</script>
</body>
</html>